package com.ctshk.rpc.season.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ctshk.common.enums.IsDeletedCode;
import com.ctshk.common.utils.EntityUtil;
import com.ctshk.rpc.season.dto.SeasonProOnlineThirdCustomDTO;
import com.ctshk.rpc.season.entity.SeasonProductChannelOnlineThirdPlatform;
import com.ctshk.rpc.season.mapper.SeasonProductChannelOnlineThirdPlatformMapper;
import com.ctshk.rpc.season.service.ISeasonProductChannelOnlineThirdPlatformService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;


/**
 * <p>
 * 套票线上渠道第三方平台 服务实现类
 * </p>
 *
 * @author 杨林
 * @since 2021-03-15
 */
@DubboService
public class SeasonProductChannelOnlineThirdPlatformServiceImpl extends ServiceImpl<SeasonProductChannelOnlineThirdPlatformMapper, SeasonProductChannelOnlineThirdPlatform> implements ISeasonProductChannelOnlineThirdPlatformService {
    @Autowired
    private SeasonProductChannelOnlineThirdPlatformMapper productChannelOnlineThirdPlatformMapper;

    @Override
    public List<SeasonProOnlineThirdCustomDTO> getThirdByStrategyId(Long strategyId) {
        List<SeasonProductChannelOnlineThirdPlatform> list = productChannelOnlineThirdPlatformMapper.selectList(
                new QueryWrapper<SeasonProductChannelOnlineThirdPlatform>().lambda()
                        .eq(SeasonProductChannelOnlineThirdPlatform::getStrategyId, strategyId)
                        .eq(SeasonProductChannelOnlineThirdPlatform::getIsDeleted, IsDeletedCode.NO.getCode())
        );
        return EntityUtil.copyList(list, SeasonProOnlineThirdCustomDTO.class);
    }

    public SeasonProOnlineThirdCustomDTO queryThird(Long fixedSeasonId) {
        return productChannelOnlineThirdPlatformMapper.queryThird(fixedSeasonId);
    }
}
